3.16 \(\int \frac{\cos (x)}{2-3 \sin (x)+\sin ^2(x)} \, dx\)

Optimal. Leaf size=17 \[ \log (2-\sin (x))-\log (1-\sin (x)) \]

[Out]

-Log[1 - Sin[x]] + Log[2 - Sin[x]]

________________________________________________________________________________________

Rubi [A]  time = 0.0270485, antiderivative size = 17, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 15, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.2, Rules used = {3258, 616, 31} \[ \log (2-\sin (x))-\log (1-\sin (x)) \]

Antiderivative was successfully verified.

[In]

Int[Cos[x]/(2 - 3*Sin[x] + Sin[x]^2),x]

[Out]

-Log[1 - Sin[x]] + Log[2 - Sin[x]]

Rule 3258

Int[cos[(d_.) + (e_.)*(x_)]^(m_.)*((a_.) + (b_.)*((f_.)*sin[(d_.) + (e_.)*(x_)])^(n_.) + (c_.)*((f_.)*sin[(d_.
) + (e_.)*(x_)])^(n2_.))^(p_.), x_Symbol] :> Module[{g = FreeFactors[Sin[d + e*x], x]}, Dist[g/e, Subst[Int[(1
 - g^2*x^2)^((m - 1)/2)*(a + b*(f*g*x)^n + c*(f*g*x)^(2*n))^p, x], x, Sin[d + e*x]/g], x]] /; FreeQ[{a, b, c,
d, e, f, n, p}, x] && EqQ[n2, 2*n] && IntegerQ[(m - 1)/2]

Rule 616

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[c/q, Int[1/Simp
[b/2 - q/2 + c*x, x], x], x] - Dist[c/q, Int[1/Simp[b/2 + q/2 + c*x, x], x], x]] /; FreeQ[{a, b, c}, x] && NeQ
[b^2 - 4*a*c, 0] && PosQ[b^2 - 4*a*c] && PerfectSquareQ[b^2 - 4*a*c]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rubi steps

\begin{align*} \int \frac{\cos (x)}{2-3 \sin (x)+\sin ^2(x)} \, dx &=\operatorname{Subst}\left (\int \frac{1}{2-3 x+x^2} \, dx,x,\sin (x)\right )\\ &=\operatorname{Subst}\left (\int \frac{1}{-2+x} \, dx,x,\sin (x)\right )-\operatorname{Subst}\left (\int \frac{1}{-1+x} \, dx,x,\sin (x)\right )\\ &=-\log (1-\sin (x))+\log (2-\sin (x))\\ \end{align*}

Mathematica [A]  time = 0.0560068, size = 26, normalized size = 1.53 \[ \log (2-\sin (x))-2 \log \left (\cos \left (\frac{x}{2}\right )-\sin \left (\frac{x}{2}\right )\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[x]/(2 - 3*Sin[x] + Sin[x]^2),x]

[Out]

-2*Log[Cos[x/2] - Sin[x/2]] + Log[2 - Sin[x]]

________________________________________________________________________________________

Maple [A]  time = 0.056, size = 14, normalized size = 0.8 \begin{align*} -\ln \left ( -1+\sin \left ( x \right ) \right ) +\ln \left ( \sin \left ( x \right ) -2 \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)/(2-3*sin(x)+sin(x)^2),x)

[Out]

-ln(-1+sin(x))+ln(sin(x)-2)

________________________________________________________________________________________

Maxima [A]  time = 0.959675, size = 18, normalized size = 1.06 \begin{align*} -\log \left (\sin \left (x\right ) - 1\right ) + \log \left (\sin \left (x\right ) - 2\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/(2-3*sin(x)+sin(x)^2),x, algorithm="maxima")

[Out]

-log(sin(x) - 1) + log(sin(x) - 2)

________________________________________________________________________________________

Fricas [A]  time = 1.35779, size = 55, normalized size = 3.24 \begin{align*} \log \left (-\frac{1}{2} \, \sin \left (x\right ) + 1\right ) - \log \left (-\sin \left (x\right ) + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/(2-3*sin(x)+sin(x)^2),x, algorithm="fricas")

[Out]

log(-1/2*sin(x) + 1) - log(-sin(x) + 1)

________________________________________________________________________________________

Sympy [A]  time = 0.209983, size = 12, normalized size = 0.71 \begin{align*} \log{\left (\sin{\left (x \right )} - 2 \right )} - \log{\left (\sin{\left (x \right )} - 1 \right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/(2-3*sin(x)+sin(x)**2),x)

[Out]

log(sin(x) - 2) - log(sin(x) - 1)

________________________________________________________________________________________

Giac [A]  time = 1.15078, size = 23, normalized size = 1.35 \begin{align*} \log \left (-\sin \left (x\right ) + 2\right ) - \log \left (-\sin \left (x\right ) + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)/(2-3*sin(x)+sin(x)^2),x, algorithm="giac")

[Out]

log(-sin(x) + 2) - log(-sin(x) + 1)